package com.hyh.admin.sys.service.impl;


import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.hyh.ad.common.core.domain.entity.SysOperLog;
import com.hyh.admin.sys.mapper.SysOperLogMapper;
import com.hyh.admin.sys.service.ISysOperLogService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.Arrays;
import java.util.Collections;
import java.util.List;

/**
 * <p>
 * 操作日志记录 服务实现类
 * </p>
 *
 * @author hyh
 * @since 2024-06-12
 */
@Service
public class SysOperLogServiceImpl implements ISysOperLogService {

    @Autowired
    private SysOperLogMapper sysOperLogMapper;

    @Override
    public int insert(SysOperLog sysOperLog) {
        return sysOperLogMapper.insert(sysOperLog);
    }

    @Override
    public List<SysOperLog> listAllSelect(SysOperLog sysOperLog) {
        LambdaQueryWrapper<SysOperLog> queryWrapper = new LambdaQueryWrapper<>(sysOperLog);
        queryWrapper.orderByDesc(SysOperLog::getId);
        return sysOperLogMapper.selectList(queryWrapper);

    }

    @Override
    public int deleteByIds(Long[] ids) {
        return sysOperLogMapper.deleteBatchIds(Arrays.asList(ids));
    }

    @Override
    public SysOperLog detail(Long id) {
        return sysOperLogMapper.selectById(id);
    }
}
